<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #container {
            width: 1000px;
            height: 1000px;
        }
    </style>
</head>

<body>
    <div id="container"></div>
</body>
<script type="text/javascript"
    src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=yE76qOvCx0PHpR3TlOA3ozaAbQHUiVdV"></script>
<script>
    let map = new BMapGL.Map("container");
    // // 创建地图实例
    let point = new BMapGL.Point(116.331398, 39.897445);

    // 设置中心点、地图级别
    map.centerAndZoom(point, 12);

    var geolocation = new BMapGL.Geolocation();
    // 获取当前坐标（回调函数）
    geolocation.getCurrentPosition(function (r) {
        if (this.getStatus() == BMAP_STATUS_SUCCESS) {
            var mk = new BMapGL.Marker(r.point);
            map.addOverlay(mk);
            map.panTo(r.point);
            alert('您的位置：' + r.point.lng + ',' + r.point.lat);
        }
        else {
            alert('failed' + this.getStatus());
        }
    });
// 创建点坐标
// map.centerAndZoom(point, 15);
// 初始化地图，设置中心点坐标和地图级别 
</script>

</html>